/****

    activequant - activestocks.eu

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

	
	contact  : contact@activestocks.eu
    homepage : http://www.activestocks.eu

****/
package org.activequant.core.domainmodel.account;

import java.io.Serializable;

import org.activequant.core.types.TimeStamp;

/**
 * 
 * Resembles a transaction for the transaction book. <br/>
 * Holds the following associated variables:
 * <ul>
 * <li>id(Long)</li>
 * <li>stamp(TimeStamp)</li>
 * <li>sum(double)</li>
 * <li>description(String)</li>
 * </ul>
 * <br/>
 * <b>History:</b><br>
 *  - [13.06.2007] Created (Ulrich Staudinger)<br/>
 *  - [14.07.2007] Added persistence (Erik Nijkamp)<br/>
 *  - [14.07.2007] Added constructor etc. (Erik Nijkamp)<br/>
 *  - [29.09.2007] Removed annotations (Erik Nijkamp)<br/>
 *  - [24.05.2009] Added description constructor (Ulrich Staudinger)<br/>
 *
 *  @author Ulrich Staudinger
 */
public class Transaction implements Serializable {

	private static final long serialVersionUID = 6589581204458930707L;
	/**
	 * private Long id;
	 */
	private Long id;
	/**
	 * private TimeStamp stamp;
	 */
	private TimeStamp stamp; 
	/**
	 * private String description;
	 */
	private String description;
	/**
	 * private double sum; 
	 */
	private double sum; 
	/**
	 * an empty Transaction constructor
	 */
	public Transaction() {

	}
	/**
	 * constructs a Transaction using the given date(TimeStamp) and sum(double) to set its associated stamp(TimeStamp) and sum(double)
	 * @param date
	 * @param sum
	 */
	public Transaction(TimeStamp date, double sum) {
		this.stamp = date;
		this.sum = sum;
	}
	/**
	 * constructs a Transaction using the given date(TimeStamp), sum(double) and description(String) to set its associated stamp(TimeStamp), sum(double) and description(String)
	 * @param date
	 * @param sum
	 * @param description
	 */
    public Transaction(TimeStamp date, double sum, String description) {
		this.stamp = date;
		this.sum = sum;
        this.description = description; 
	}
    /**
     * returns the associated id(Long)
     * @return
     */
	public Long getId() {
		return id;
	}
	/**
	 * sets the associated id(Long) with the given id(Long)
	 * @param id
	 */
	public void setId(Long id) {
		this.id = id;
	}
	/**
	 * returns whether the associated id(Long) is not <code>null</code>
	 * @return
	 */
	public boolean hasId() {
		return id != null;
	}

	/**
	 * returns the associated stamp(TimeStamp)
	 * @return
	 */
	public TimeStamp getTimeStamp() {
		return stamp;
	}

	/**
	 * sets the associated stamp(TimeStamp) with the given date(TimeStamp)
	 * @param date
	 */
	public void setTimeStamp(TimeStamp date) {
		this.stamp = date;
	}
	/**
	 * returns the associated sum(double)
	 * @return
	 */
	public double getSum() {
		return sum;
	}
	/**
	 * sets the associated sum(double) with the given sum(double)
	 * @param sum
	 */
	public void setSum(double sum) {
		this.sum = sum;
	}
	/**
	 * returns the associated description(String)
	 * @return
	 */
	public String getDescription() {
		return description;
	}
	/**
	 * sets the associated description(String) with the given description(String)
	 * @param description
	 */
	public void setDescription(String description) {
		this.description = description;
	}
}